package ua.cn.store.domain;


import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.sun.istack.internal.NotNull;

@Entity
@Table(name="Usrs")
@NamedQueries({
	@NamedQuery(name="User.findUserByName",query="select u from User u where u.fName like :u_fName")
})
public class User extends Domain  {
	
	private static final long serialVersionUID = 1L;
	private String email;
	@NotNull
	private String fName;
	private String sName;
	@NotNull
	private String tel;
	private List<Order> u_orders = new ArrayList<Order>();
	
	//@Embedded
	private Account account; 
	
	/*@OneToMany(mappedBy="User",cascade=CascadeType.ALL)
	public List<Order> getOrders() {
		return u_orders;
	}*/

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public void setOrders(List<Order> u_orders) {
		this.u_orders = u_orders;
	}

	/*private Account acc_id;
	
	@OneToOne
	@JoinColumn(name="acc_id", referencedColumnName ="id")
	public Account getAcc_id() {
		return acc_id;
	}

	public void setAcc_id(Account acc_id) {
		this.acc_id = acc_id;
	}
*/
	@Enumerated		
	private Roles role;

	@Column(name="e_mail")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	@Column(name="f_Name")
	public String getfName() {
		return fName;
	}

	public void setfName(String fName) {
		this.fName = fName;
	}
	@Column(name="s_Name")
	public String getsName() {
		return sName;
	}

	public void setsName(String sName) {
		this.sName = sName;
	}
	@Column(name="phone")
	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public Roles getRole() {
		return role;
	}

	public void setRole(Roles role) {
		this.role = role;
	}

	

}
